<?php

/**
 * Project: Espolon
 * Licence: BSD License
 * Link: http://espolon.org/
 * Copyright: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Author: Nicolas de Bari Embriz Garcia Rojas <nbari at espolon dot org>
 * Version: Beta
 */


/**
 *  Signup
 */
$user = new User();

if ($options[0] == 'code') {
  if (!empty($options[1]) AND $user->confirmCode($options[1])) {
    $tpl->assign('sitename', $user->getConfig('site_name'));
    $tpl->assign('result', true); #activar usuario
  } else {
    $tpl->assign('msg',$user->getMsg());
    $tpl->assign('result', false); 
  }
} else {
  $form = new SignUpForm($tpl, $user);
  // Try to validate a form
  if ($form->validate()) {
    $form->freeze();
    $form->process();
  } else {
    $form->displayForm();
  }
}

?>